/**
 * FileFind - ftp/shares indexing and search php engine
 * Module: common-webapp
 * Description: Common classes for different webapp implementations
 * Copyright (c) 2003-2010 Rage Steel, www.gt2.ru
 */
package ru.ffind.webapp.beans;

import java.net.URL;
import java.util.Properties;

/**
 * Version information for the project.
 *
 * @author Rage Steel
 */
public abstract class AbstractVersionBean {
	
	private static final String VERSION;
	
	private static final int YEAR_BEGIN = 2003;
	
	private static final int YEAR_END = 2011;
	
	static {
		Properties properties = new Properties();
		try {
			// TODO Use spring ClassPathResource instead
			URL url = AbstractVersionBean.class.getClassLoader().getResource("ffind.properties");
			properties.load(url.openStream());
		} catch (Exception e) {
			// Nothing to do with exception
		}
		VERSION = properties.getProperty("ffind.version", "UNKNOWN");
	}
	
	/**
	 * Return version string, extracted from the properties.
	 * 
	 * @return
	 */
	public String getVersion() {
		return VERSION;
	}
	
	
	/**
	 * Return begin year for copyright information.
	 * 
	 * @return
	 */
	public int getYearBegin() {
		return YEAR_BEGIN;
	}
	
	/**
	 * Return end year for copyright information.
	 * 
	 * @return
	 */
	public int getYearEnd() {
		return YEAR_END;
	}
}
